package com.hubery.designpattern.design.template.commodity;

import com.hubery.designpattern.design.chain.DefaultChainManageService;
import com.hubery.designpattern.dto.PrizeProvideReqDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author: lxy
 * @date: 2023/2/27 23:20
 * @Description:
 */
@Slf4j
@Component
public abstract class AbstractCommodityTemplate implements CommodityService {

    @Resource
    protected DefaultChainManageService chainManageService;

    @Override
    public void process(PrizeProvideReqDTO reqDTO) {

        //发放奖品
        Object o = provide(reqDTO);

        //后续操作
        afterHandle(o);
    }

    abstract protected Object provide(PrizeProvideReqDTO reqDTO);

    abstract public void afterHandle(Object o);
}
